Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TypeDurationSecond for TTL values in PKI. #3270

Merged
merged 3 commits into from
Aug 31, 2017
Merged

Conversation

jefferai
Copy link
Member

This has the side effect of simplifying logic quite a bit.

This also fixes/changes parseutil.ParseDurationSecond to return a
duration of 0 if the input is a string but empty.

This has the side effect of simplifying logic quite a bit.

This also fixes/changes parseutil.ParseDurationSecond to return a
duration of 0 if the input is a string but empty.
@jefferai jefferai added this to the 0.8.2 milestone Aug 31, 2017
vishalnayak
vishalnayak previously approved these changes Aug 31, 2017
Copy link
Member

@vishalnayak vishalnayak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments. Otherwise LGTM!

t.Fatal(err)
}
if resp != nil && resp.IsError() {
t.Fatalf(resp.Error().Error())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need for double Error() here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe if I switch it to t.Fatal -- t.Fatalf expects a string, and resp.Error() returns an error

ttl, err = parseutil.ParseDurationSecond(role.TTL)
if err != nil {
return nil, errutil.UserError{Err: fmt.Sprintf(
"invalid requested ttl: %s", err)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be a requested ttl. Its coming from role. Can we change the error message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah

if len(role.MaxTTL) == 0 {
maxTTL = b.System().MaxLeaseTTL()
} else {
if role.MaxTTL != "" {
maxTTL, err = parseutil.ParseDurationSecond(role.MaxTTL)
if err != nil {
return nil, errutil.UserError{Err: fmt.Sprintf(
"invalid ttl: %s", err)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max_ttl

@jefferai jefferai merged commit f3a3e5a into master Aug 31, 2017
@jefferai jefferai deleted the pki-typedurationsecond branch August 31, 2017 19:49
chrishoffman pushed a commit that referenced this pull request Sep 1, 2017
* oss/master:
  Plugin Version Update (#3275)
  Lazy-load plugin mounts (#3255)
  changelog++
  changelog++
  Add pki/root/sign-self-issued. (#3274)
  Travis, be happier please
  changelog++
  Change auth helper interface to api.Secret. (#3263)
  changelog++
  Try reconnecting Mongo on EOF (#3269)
  Don't append a trailing slash to the request path if it doesn't actually help find something (#3271)
  changelog++
  Use TypeDurationSecond for TTL values in PKI. (#3270)
  changelog++
  changelog++
  Use net.SplitHostPort on Consul address (#3268)
  Normalize plugin_name option for mount and enable-auth (#3202)
  Updating Okta lib for credential backend (#3245)
  Explicitly mention that aws/aws-ec2 were unified under aws.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants